<!DOCTYPE html>
<html>
<head>
	<title>餐饮营销支持系统</title>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link href="../../css/bootstrap.min.css" rel="stylesheet">
	<!-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> -->
	<link rel="stylesheet" type="text/css" href="../../css/waiter.css">
	<link rel="stylesheet" type="text/css" href="../../css/boss.css">
</head>
<body>
	<div id="head">
		<div class="navbar navbar-default  navbar-inverse" role="navigation">
			<div class="navbar-header">
				<a href="##" class="navbar-brand">餐饮营销支持系统</a>
			</div>
			<button type="submit" class="btn btn-danger">
				<span style="margin-right: 5px" class="glyphicon glyphicon-off"></span>注销
			</button>
		</div>
	</div>
	<div id="left">
		<p class="left-head">
			boss登录
		</p>
		<div class="container">
			<div class="row" style="margin-top: 0px">
				<a href="./boss.html">
					<div class="col-md-12">
						<span class="glyphicon glyphicon-user"></span>
						<p>个人信息</p>
					</div>
				</a>
			</div>
			<div class="row">
				<a href="./boss-two.html">
					<div class="col-md-12">
						<span class="glyphicon glyphicon-home"></span>
						<p>店铺管理</p>
					</div>
				</a>
			</div>
			<div class="row">
				<a href="./boss-three.html">
					<div class="col-md-12">
						<span class="glyphicon glyphicon-plus-sign"></span>
						<p>店铺人员</p>
					</div>
				</a>
			</div>
			<div class="row">
				<a href="./boss-four.html">
					<div class="col-md-12">
						<span class="glyphicon glyphicon-list"></span>
						<p>菜单管理</p>
					</div>
				</a>
			</div>
			<div class="row act">
				<div class="col-md-12">
					<span class="glyphicon glyphicon-retweet"></span>
					<p>收益比例</p>
				</div>
			</div>
			<div class="row">
				<a href="./boss-six.html">
					<div class="col-md-12">
						<span class="glyphicon glyphicon-th"></span>
						<p>收入查询</p>
					</div>
				</a>
			</div>
		</div>
	</div>
	<div id="right">
		<div class="right-head">
			<ol class="breadcrumb">
				<li><a href="#">首页</a></li>
				<li class="active">收益比例设置</li>
			</ol> 
		</div>
		<div class="con">
			<div class="container">
				<div class="row">
					<div class="col-md-12">
						<div class="panel panel-default">
							<div class="panel-body">
								<div class="row">
									<p class="from-top">
										收益比例设置
									</p>
								</div>
								<div class="row">
									<label class="col-lg-3 control-label">
										当前收益比例：
									</label>
									<label class="col-lg-1 control-label" id="nowfirst">
									</label>
									<label class="col-lg-2 control-label" id="nowsecond">
									</label>
									<label class="col-lg-2 control-label" id="nowthird">
									</label>
								</div>
								<hr>
								<div class="row">
									<label class="col-lg-3 control-label">
										设置一级收益比例：
									</label>
									<div class="col-lg-7">
										<input type="text" name="first" placeholder="输入一级比例值" class="bg-focus form-control" id="newfirst">
									</div>
								</div>
								<div class="row">
									<label class="col-lg-3 control-label">
										设置二级收益比例：
									</label>
									<div class="col-lg-7">
										<input type="text" name="second" placeholder="输入二级比例值" class="bg-focus form-control" id="newsecond">
									</div>
								</div>
								<div class="row">
									<label class="col-lg-3 control-label">
										设置三级收益比例：
									</label>

									<div class="col-lg-7">
										<input type="text" name="third" placeholder="输入三级比例值" class="bg-focus form-control" id="newthird">
									</div>
									<div class="col-lg-2">
										<button id="make-profit" type="button" class="btn btn-primary btn-sm">
											<span style="margin-right: 5px"  class="glyphicon glyphicon-check"></span>确定
										</button>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<script src="../../js/Jquary/jquery-3.2.1.min.js"></script>
	<script src="../../js/Jquary/jquery.easyui.min.js"></script>
	<script src="../../js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../../js/logout.js"></script>
	<script type="text/javascript" src="../../js/isnumber.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#make-profit").click(function(){
				var x=$("*[name='first']").val();
				var y=$("*[name='second']").val();
				var z=$("*[name='third']").val();
				if(isFloat(x)&&isFloat(y)&&isFloat(z)){
					if (x>=0&&x<=10&&y>=0&&y<=10&&z>=0&&z<=10) {
						setRate(x,y,z);
					}else{
						alert("请输入0到10之间的数！")
					}
				}else{
					alert("请检查输入格式");
				}
			})
			getNowRate();
			
		})
	</script>
	<script type="text/javascript">
		function setRate(x,y,z){
			$.ajax({
				type:"get",
				url:"/ldss/yieldrate/addyieldrate",
				data:{
					firstrate:x,
					secondrate:y,
					thirdrate:z
				},
				async:false,
				dataType:"json",
				success: function (data) {
					if(data.success){
						var data = data;
						alert(data.message);
						getNowRate();
					}else{
						alert(data.message);
					}
				}
			});
		}
		
		function getNowRate(){
			$.ajax({
				type:"get",
				url:"/ldss/yieldrate/seeyieldrate",
				async:false,
				dataType:"json",
				success: function (data) {
					if(data.success){
						var data = data.data;
						$("#nowfirst").empty();
						$("#nowfirst").append("一级："+data.firstRate);
						$("#nowsecond").empty();
						$("#nowsecond").append("二级："+data.secondRate);
						$("#nowthird").empty();
						$("#nowthird").append("三级："+data.thirdRate);
					}
					else{
						alert(data.message);
					}
				}
			})
		}
	</script>
</body>
</html>